package com.blb.educourseservice.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.blb.common.entity.CourseOrientation;
import com.blb.educourseservice.mapper.CourseOrientationMapper;
import com.blb.educourseservice.service.CourseOrientationService;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class CourseOrientationServiceImpl extends ServiceImpl<CourseOrientationMapper, CourseOrientation> implements CourseOrientationService {

    @Override
    public List<CourseOrientation> findTopOrientations() {
        List<CourseOrientation> list = this.list(new QueryWrapper<CourseOrientation>().lambda().eq(CourseOrientation::getParentId, 0));
        return list;
    }

    @Override
    public List<CourseOrientation> findOrientationsByParentId(Long parentId) {

        List<CourseOrientation> list = this.list(new QueryWrapper<CourseOrientation>().lambda().eq(CourseOrientation::getParentId, parentId));
        return list;
    }
}
